import {defineStore} from "pinia";
import {ref} from "vue";
import {LoginDto} from "@/base/ts/api/biz/AuthApi.ts";
import {DictItem} from "@/base/ts/api/biz/SysDictItemApi.ts";
import {SysMenu} from "@/base/ts/api/biz/SysMenuApi.ts";

//用户相关,登出会删除的部分
export const userStore = defineStore('userStore', {
  state: () => ({
    userInfo: ref<LoginDto>(),
    tabsMenus: ref<SysMenu[]>([]),
  }),
  persist: true, //持久化
})

//页面缓存
export const cacheStore = defineStore('cacheStore', {
  state: () => ({
    //是否保持登录
    isKeepLogin: false,
    //当前语言
    lang: 'zh-CN', //en-US英文 zh-CN中文 de-DE德语
    //语言包
    langPack: ref<Record<string, any>>(),
    //字典
    dictItems: ref<DictItem[]>(),
    //默认首页
    homePage: '/index',
    //默认登录页
    loginPage: '/outside/login',
  }),
  persist: true,
})


//主题相关
export const themeStore  = defineStore('themeStore', {
  state: () => ({
    //主题类型
    type: 'default',
    //菜单是否折叠
    isCollapse: false,
  }),
  persist: true,
})


